import * as math from 'mathjs'

// 加法
export const add = (num1: any, num2: any): string => {
  return math.format(math.add(math.bignumber(num1), math.bignumber(num2)))
}
// 减法
export const subtract = (num1: number, num2: number): string => {
  return math.format(math.subtract(math.bignumber(num1), math.bignumber(num2)))
}
// 乘法
export const multiply = (num1: number, num2: number): string => {
  return math.format(math.multiply(math.bignumber(num1), math.bignumber(num2)))
}

// 除法
export const divide = (num1: number, num2: number): string => {
  return math.format(math.divide(math.bignumber(num1), math.bignumber(num2)))
}

// 四舍五入
export const round = (number: number, n = 0) => {
  return math.round(number, n)
}
